import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: HomeView,
    children: [
      {
        path: "/",
        component: () => import("../views/home/index.vue"),
      },
      {
        path: "about",
        component: () => import("../views/about/index.vue"),
        redirect: "/about/about-us",
        children: [
          {
            path: "about-us",
            component: () => import("../views/about/components/aboutUs.vue"),
          },
          {
            path: "about-develop",
            component: () => import("../views/about/components/develop.vue"),
          },
          {
            path: "about-honor",
            component: () => import("../views/about/components/honor.vue"),
          },
          {
            path: "about-staffStyle",
            component: () => import("../views/about/components/staffStyle.vue"),
          },
          {
            path: "about-study",
            component: () => import("../views/about/components/study.vue"),
          },
          {
            path: "about-culture",
            component: () => import("../views/about/components/culture.vue"),
          },
        ],
      },
      {
        path: "news",
        component: () => import("../views/news/index.vue"),
        redirect:'news/news-enterprise',
        children: [
          {
            path:'news-enterprise',
            component:()=>import('../views/news/components/enterprise.vue')
        },
          {
            path:'news-trade',
            component:()=>import('../views/news/components/trade.vue')
        },
          {
            path:'news-info',
            component:()=>import('../views/news/components/info.vue')
        },
      ],
      },
      {
        path:'pro',
        component:()=>import('../views/product/index.vue'),
        redirect:'/pro/pro-introduce',
        children:[
          {
            path:'pro-introduce',
            component:()=>import('../views/product/components/introduce.vue')
          },
          {
            path:'pro-catalogue',
            component:()=>import('../views/product/components/catalogue.vue')
          },
        ]
      },
      {
        path:'core',
        component:()=>import('../views/core/index.vue'),
        redirect:'/core/core-dev',
        children:[
          {
            path:'core-dev',
            component:()=>import('../views/core/components/dev.vue')
          },
          {
            path:'core-technology',
            component:()=>import('../views/core/components/technology.vue')
          }

        ]
      },
      {
        path: 'job',
        component: () => import('../views/job/index.vue'),
      },
      {
        path: 'contact',
        component: () => import('../views/contact/index.vue'),
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
